package querysrc;
import java.sql.Connection;
import java.sql.SQLException;

import com.subway.babynote.syncdata.*;



public class query_change_user_birth_gender extends query {
	public query_change_user_birth_gender(sqlConnectionHandler sqlconhandler)
	{
		super(sqlconhandler);
	}
	
	public int update_user_birth_gender(ClientDataRecord.usersRecord ur)
	{
		querydb qdb = null;
		Connection con = null;
		try
		{
			boolean bret = true;
			con = this.init();	
			int iret = -1;
			
			if(bret)
			{
				qdb = new querydb(con,sqlscripts.sql_login_user_change_birth);
				bret = qdb.prePS();
			}
			if(bret)
			{
				qdb.ps.setDate(1, ur.birth);
				qdb.ps.setBoolean(2, ur.gender);
				qdb.ps.setInt(3, ur.ts);
				qdb.ps.setInt(4, ur.user_id);
				iret = qdb.execPSUpdate();
			}
			
			return iret;
		}
		catch(SQLException se) {
		      System.out.println("SQLException: "+se.getMessage());
		      return -1;
	    }
		catch(Exception e)
		{
			e.printStackTrace();
			return -1;
		}
		finally
		{
			
			this.release_querydb(qdb);
			this.release_connection(con);
			this.finalize();
		}
	}
}
